﻿using Shop.RemoteModel.PageModuleGoods;
using Shop.RemoteModel.PageModuleGoods.Model;
using Shop.RemoteModel.SpuGoods;
using Shop.RemoteModel.SpuGoods.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class PageModuleGoodsEvent : IRpcApiService
    {
        private readonly IPageModuleGoodsService _Service;

        public PageModuleGoodsEvent ( IPageModuleGoodsService service )
        {
            this._Service = service;
        }
        public SpuDatum[] GetsModuleTopGoods( GetsModuleTopGoods obj )
        {
            return _Service.GetTops(obj.ModuleId, obj.TagKey, obj.Top);
        }
        public PagingResult<SpuDatum> QueryModuleSpu ( QueryModuleSpu obj )
        {
            return _Service.Query(obj.TModuleId, obj.TagKey, obj.ToBasicPage());
        }
        public void DeleteModuleGoods ( DeleteModuleGoods obj )
        {
            this._Service.Delete(obj.Id);
        }
        public void BatchDeleteModuleGoods ( BatchDeleteModuleGoods obj )
        {
            this._Service.Delete(obj.Ids);
        }
        public Dictionary<long, int> SetModuleGoodsSort ( SetModuleGoodsSort obj )
        {
            return this._Service.SetSort(obj.Id, obj.Sort);
        }
        public ModuleGoodsDto[] GetModuleGoods ( GetModuleGoods obj )
        {
            return this._Service.GetGoods(obj.TModuleId, obj.TagKey);
        }

        public ModuleGoodsDto[] SyncModuleGoods ( SyncModuleGoods obj )
        {
            return this._Service.Sync(obj.Datum);
        }
    }
}
